<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class News extends CI_Controller {

    public function __construct() {
        parent::__construct();
    }

    public function index() {
        /*$this->template->set_template('guest');
        $this->template->add_css("assets/css/main.css");
        $this->template->add_js("assets/js/jquery.min.js");
        $this->template->add_css("assets/css/footerexpand.css");
        $this->template->add_js("assets/js/footerexpand.js");
        $this->template->write('title', 'news'); */
    	
        $this->load->model("guest_model");
        $param['page'] = "news";
        $data['berita'] = $this->guest_model->getBeritaByPage($param);
        /* $this->template->write_view('content', 'guest/news', $data);
        $this->template->render(); */
        
        $this->load->view('essential/template', $data);
    }

    public function detail() {
        $this->load->model("guest_model");

        $data = array();
        $param = array('judul_url' => $this->uri->segment(3));
        $data['berita'] = $this->guest_model->getBeritaByPage($param);

        if ($data['berita'] == FALSE) {
            $data['berita']['judul'] = 'Data Not Found';
            $data['berita']['isi'] = 'Please Add Home News';
        }


        $this->load->view('essential/template', $data);
    }

}